<?php
	session_start();
	header('Content-type:image/jpeg');
	$hwnd = imagecreatetruecolor(135,65);
	$bgcolor = imagecolorallocate($hwnd,255,255,255);
	imagefill($hwnd,0,0,$bgcolor);
	$str = '3456789aAbBcCdDeEfFgGhHkKmMnNpPsStTuUvVwWxXyY';
	$code = str_shuffle($str);
	$_SESSION['code']='';
	for($i=0;$i<4;$i++){
		$fontColor = imagecolorallocate($hwnd,rand(50,200),200,rand(50,200));
		imagettftext($hwnd,rand(20,35),rand(-40,40),12+($i*30),45,$fontColor,'./arialbd.ttf',$code[$i]);
		$_SESSION['code'] .= $code[$i];
	}
	for($i=0;$i<999;$i++){
		$fontColor = imagecolorallocate($hwnd,rand(0,255),rand(0,255),$b = rand(0,255));
		imagesetpixel($hwnd,rand(0,400),rand(0,400),$fontColor);
	}
	imagejpeg($hwnd);
	imagedestroy($hwnd);
	